import toast from 'react-hot-toast';
import ApiError from '../apis/ApiError';

export const toastError = (err: unknown) => {
  if (err instanceof ApiError) {
    // TODO: 美化
    toast.error(err.message);
  } else if (err instanceof Error) {
    toast.error(err.message);
  } else {
    toast.error('An error occurred');
  }
};
